package com.sky.loveshop.service.impl;

import com.sky.loveshop.entity.DeliverRecord;
import com.sky.loveshop.mapper.DeliverRecordMapper;
import com.sky.loveshop.service.DeliverRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * @author xcy
 * @version V1.0
 * @description
 * @date 2024/9/15 18:32
 */
@Service
public class DeliverRecordServiceImpl implements DeliverRecordService {

    @Autowired
    private DeliverRecordMapper deliverRecordMapper;

    @Override
    public Integer insertOne(DeliverRecord deliverRecord) {
        return deliverRecordMapper.insert(deliverRecord);
    }

    @Override
    public DeliverRecord getOneByPlatformOrderId(String platformOrderId) {
        Example example = new Example(DeliverRecord.class);
        example.createCriteria().andEqualTo("platformOrderId", platformOrderId);
        return deliverRecordMapper.selectOneByExample(example);
    }

    @Override
    public List<DeliverRecord> getListByPlatformOrderIds(List<String> platformOrderIds) {
        Example example = new Example(DeliverRecord.class);
        example.createCriteria().orIn("platformOrderId", platformOrderIds);
        return deliverRecordMapper.selectByExample(example);
    }
}
